home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / windows / utils / cb200.arj / LINES.PA_ / LINES.PA
Text File  |  1993-09-01  |  5KB  |  195 lines

  1. Library Lines;
  2.  
  3. {define Debug}
  4.  
  5. {$ifndef Debug}
  6. {$R-,I-,D-,L-,S-,V-,W-,G+}
  7. {$endif}
  8.  
  9. {$C MOVEABLE PRELOAD DISCARDABLE}
  10. {$R LINES}
  11.  
  12. Uses
  13.   WinTypes,WinProcs,Strings,WinDOS;
  14.  
  15. {$I ADD-IN.INC}
  16.  
  17. Const
  18.   LineThick : Integer = 2;
  19.   DiscMode : Boolean = True;
  20.  
  21.   CLBVer : VerString = '2.00';
  22.  
  23. {$D Lines Add-In. (C) 1992, 1993 by clySmic Software. All Rights Resv'd.}
  24.  
  25. {-----------------------------------------------}
  26.  
  27. { --- Perform Add-In's initialization --- }
  28.  
  29. Function AddInInit(CurVer : PChar) : InitResult; Export;
  30.  
  31. Begin
  32.   Randomize;
  33.  
  34.   { Version check }
  35.   If StrComp(CurVer,CLBVer) <> 0
  36.     Then AddInInit := InitNotOk
  37.     Else AddInInit := InitOk;
  38. End {AddInInit};
  39.  
  40. {-----------------------------------------------}
  41.  
  42. { --- Paint on the button (Clysbar does the background) --- }
  43.  
  44. Procedure AddInPaint(Wnd : HWnd; DC : HDC; Pressed : Boolean); Export;
  45.  
  46. Begin
  47. End {AddInPaint};
  48.  
  49. {-----------------------------------------------}
  50.  
  51. { --- Tell Clysbar what kind of timer we need --- }
  52.  
  53. Function AddInTimerNeeded : Integer; Export;
  54.  
  55. Begin
  56.   AddInTimerNeeded := ait_Fast;
  57. End {TimerNeeded};
  58.  
  59. {-----------------------------------------------}
  60.  
  61. { --- Proc called when timer expires, perform timed duties --- }
  62.  
  63. Procedure AddInTimerTick(Wnd : HWnd; DC : HDC); Export;
  64.  
  65. Const
  66.   xSav : Integer = 5;
  67.   ySav : Integer = 5;
  68.  
  69. Var
  70.   Rect : TRect;
  71.   OldPen,ThePen : HPen;
  72.  
  73. Begin
  74.   { If add-in is never uncovered, Wnd will be NULL }
  75.   If Wnd = 0
  76.     Then Exit;
  77.  
  78.   { Don't draw over button "edges" }
  79.   GetClientRect(Wnd,Rect);
  80.   InflateRect(Rect,-6,-6);
  81.  
  82.   { Draw a random line in a random color }
  83.   ThePen := CreatePen(ps_Solid,LineThick,RGB(Random(256),Random(256),Random(256)));
  84.   OldPen := SelectObject(DC,ThePen);
  85.  
  86.   If DiscMode
  87.     Then Begin
  88.            { Disconnected lines }
  89.            MoveTo(Dc,Random(Rect.Right-2) + Rect.Left-2,
  90.                      Random(Rect.Bottom-2) + Rect.Top-2);
  91.            LineTo(Dc,Random(Rect.Right-2) + Rect.Left-2,
  92.                      Random(Rect.Bottom-2) + Rect.Top-2);
  93.          End
  94.     Else Begin
  95.            { Connected lines }
  96.            MoveTo(DC,xSav,ySav);
  97.            xSav := Random(Rect.Right-2) + Rect.Left-2;
  98.            ySav := Random(Rect.Bottom-2) + Rect.Top-2;
  99.            LineTo(DC,xSav,ySav);
  100.          End;
  101.  
  102.   { Clean up }
  103.   SelectObject(DC,OldPen);
  104.   DeleteObject(ThePen);
  105. End {AddInTimerTick};
  106.  
  107. {-----------------------------------------------}
  108.  
  109. { --- Proc called when button pressed --- }
  110.  
  111. Procedure AddInPressed(Wnd : HWnd; DC : HDC); Export;
  112.  
  113. Begin
  114.   LineThick := Random(4) + 1;    {1..4}
  115.  
  116.   DiscMode := Not DiscMode;
  117.  
  118.   AddInPaint(Wnd,DC,False);
  119. End {AddInPressed};
  120.  
  121. {-----------------------------------------------}
  122.  
  123. { --- Exit processing for Add-In --- }
  124.  
  125. Procedure AddInExit; Export;
  126.  
  127. Begin
  128. End {AddInExit};
  129.  
  130. {-----------------------------------------------}
  131.  
  132. { --- Clysbar queries Add-In about itself (N.B.: not implemented yet) --- }
  133.  
  134. Procedure AddInAbout(Str1,Str2 : PChar;
  135.                      Var TheIcon : HIcon;
  136.                      Var TitleCol,TxCol,BkCol : TColorRef); Export;
  137.  
  138. Begin
  139.   StrCopy(Str1,'Lines V2.00');
  140.   StrCopy(Str2,'A Random Line Drawer'#13'⌐ 1992, 1993 by clySmic Software.'#13'All Rights Reserved.');
  141.  
  142.   TheIcon := LoadIcon(hInstance,'ABOUT');
  143.  
  144.   TitleCol := RGB(255,0,255);
  145.   TxCol := RGB(128,0,128);
  146.   BkCol := RGB(255,255,255);
  147. End {AddInAbout};
  148.  
  149. {-----------------------------------------------}
  150.  
  151. { --- Clysbar queries Add-In whether it'll accept d'n'd --- }
  152.  
  153. Function AddInAcceptDrops : Boolean; Export;
  154.  
  155. Begin
  156.   AddInAcceptDrops := False;
  157. End {AddInAcceptDrops};
  158.  
  159. {-----------------------------------------------}
  160.  
  161. { --- Clysbar informs Add-In of a d'n'd drop --- }
  162.  
  163. Procedure AddInDrop(hDrop : THandle); Export;
  164.  
  165. Begin
  166. End {AddInDrop};
  167.  
  168. {-----------------------------------------------}
  169.  
  170. { --- Clysbar queries Add-In for Info Window text --- }
  171.  
  172. { Return a zero-length string if you don't want to chg the text }
  173.  
  174. Procedure AddInGetInfoWinTx(Tx : PChar); Export;
  175.  
  176. Begin
  177.   StrCopy(Tx,'');
  178. End {AddInGetInfoWinTx};
  179.  
  180. {-----------------------------------------------}
  181.  
  182. Exports AddInInit         Index 1,
  183.         AddInPaint        Index 2,
  184.         AddInTimerNeeded  Index 3,
  185.         AddInTimerTick    Index 4,
  186.         AddInPressed      Index 5,
  187.         AddInExit         Index 6,
  188.         AddInAbout        Index 7,
  189.         AddInAcceptDrops  Index 8,
  190.         AddInDrop         Index 9,
  191.         AddInGetInfoWinTx Index 10;
  192.  
  193. Begin
  194. End.
  195.